package movee.ssh.client;

import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class SshClientApplication {

    public static void main(String[] args) {
        SpringApplication.run(SshClientApplication.class, args);
    }


    @Bean
    public CommandLineRunner runner() {
        return (args) -> {
            LocalSshClient sshClient = new LocalSshClient("192.168.238.226", "trust", "Trust@123", "huawei");
            sshClient.connect();
            sshClient.sendThenExpect("screen-length 0 temporary",
                    LocalSshClient.CMD_PROMPT, LocalSshClient.EXEC_TIMEOUT);
            sshClient.sendThenExpect("dis curr config",
                    LocalSshClient.CMD_PROMPT, LocalSshClient.EXEC_TIMEOUT);
            sshClient.send("quit");
            sshClient.close();
        };
    }
}
